# coding: UTF-8
# ----------
# Project_Name : pythonProject
# File_Name : huangcongbing
# Author : asus
# Date_Time:2022/4/24 10:50
# Description :
# ----------
from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

def foo1():
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.get('https://map.baidu.com/@11585280.82,3555907.48,12z')
    driver.find_element(By.CLASS_NAME,'close-btn').click()#关闭登录窗口
    #点击鼠标右键
    #context_clik(elemrnt=none):右键点击这个元素
    #没有参数，默认参数值是none，右键点击鼠标当前位置（打开网页后的鼠标当前位置是坐标原点）
    # ActionChains(driver).context_click().perform()
    # time.sleep(3)
    # #双击地图
    # ActionChains(driver).double_click().perform()
    # time.sleep(3)
    #按住左键不放
    # ActionChains(driver).click_and_hold().perform()
    # time.sleep(3)
    # #根据距离移动鼠标
    # ActionChains(driver).move_by_offset(500,500).perform()#鼠标向右向下移动500个像素点
    # time.sleep(3)
    # #释放或者放开鼠标
    # ActionChains(driver).release().perform()
    # time.sleep(3)
    # #拖拽鼠标的操作
    # # 注意 这里需要三个元素，是上面三个操作的拼接
    # #参数：element如果点击当前鼠标，传值为None
    # #xoffset，x轴移动距离
    # #yoffset，y轴的移动距离
    # ActionChains(driver).drag_and_drop_by_offset(None,-500,-500)
    time.sleep(3)
    # ActionChains可以将多个操作构成动作的链条一次执行
    ActionChains(driver).click_and_hold().move_by_offset(500,500).release().perform()
    time.sleep(5)


    driver.quit()
if __name__ == "__main__":
        foo1()